package com.shadow.baiqun.delegate.room.check;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.rey.material.app.Dialog;
import com.shadow.baiqun.R;

/**
 * @author zy
 *         on 2018/7/8
 */
public class OperationDialog extends Dialog {
    public OperationDialog(Context context, OnActionListener listener) {
        super(context);
        init(context, listener);
    }

    private void init(Context context, final OnActionListener listener) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.dialog_pre_goods_operation, null);
        setContentView(view);
        Button btnDetail = view.findViewById(R.id.btn_check_location);
        btnDetail.setText("详情");
        btnDetail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null) {
                    listener.onOrderDetail();
                }
            }
        });
        Button btnComplete = view.findViewById(R.id.btn_goods_back_home);
        btnComplete.setText("货物归位");
        btnComplete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null) {
                    listener.onOrderComplete();
                }
            }
        });
        view.findViewById(R.id.btn_order_detail).setVisibility(View.GONE);
    }

    public interface OnActionListener {
        void onOrderComplete();

        void onOrderDetail();
    }
}
